clear all;

cd ..; cd ..; cd ..;
load('code_main_model\6_implied_w_r\computation_results\data.mat','Y','frac_entre','frac_credit');
cd 'code_figure_table\OA\Figure OA50'; 

x=0:30;
index=1:31;

output=Y(index);
credit=frac_credit./frac_entre;
credit=credit(index);

fig=figure('color', [1 1 1 ], 'Position',[200 20 800 320]);
handle=subplot(1,2,1);
plot(x, output, '-b' , 'LineWidth', 2 );
hold on
plot([10,10], [0,100], '--k' , 'LineWidth', 1 );
title( 'A. Output', 'FontSize',15,'Interpreter','Latex');
annotation('arrow',[0.27  0.24],[0.8 0.8], 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(13.5, 1.24, 'close a branch', 'FontSize',12,'Interpreter','Latex');


xlabel('year $t$', 'FontSize',12,'Interpreter','Latex');
ylabel('output', 'FontSize',12,'Interpreter','Latex');
xlim([0 30]);
ylim([0.4, 1.4]);
yticks(0.4:0.2:1.4);

ax = gca;
% ax.YRuler.Exponent = 0;
set(gca,'FontSize',12);


handle=subplot(1,2,2);
plot(x, credit.*100, '-b' , 'LineWidth', 2 );
hold on
plot([10,10], [0,100], '--k' , 'LineWidth', 1 );
title( 'B. Entrepreneurs with bank loans', 'FontSize',15,'Interpreter','Latex');
annotation('arrow',[0.71  0.68],[0.8 0.8], 'LineStyle','-.','color',[0 0 0], 'Headstyle', 'vback2', 'HeadWidth', 3);
text(13.5, 25.2844, 'close a branch', 'FontSize',12,'Interpreter','Latex');


xlabel('year $t$', 'FontSize',12,'Interpreter','Latex');
ylabel('entrepreneurs with bank loans (\%)', 'FontSize',12,'Interpreter','Latex');
xlim([0 30]);
ylim([0, 30]);
yticks(0:10:30);
ax = gca;
% ax.YRuler.Exponent = 0;
set(gca,'FontSize',12);